﻿using System;
using System.Globalization;
using System.Net;
using System.Reflection.Metadata;
using System.Security.Cryptography;
using System.Text;
using System.Linq;
using System.Text.Json;
using System.Text.Encodings.Web;
using System.Security.Cryptography.X509Certificates;

using System.Drawing;
using System.Drawing.Imaging;

namespace UnvApi
{
    public class Program
    {

        static async Task Main(string[] args)
        {

            //long timeStart = TimeFormatter.stringToTimestamp("2024-03-01", "yyyy-MM-dd");
            //long timeEnd = TimeFormatter.stringToTimestamp("2024-03-02", "yyyy-MM-dd");
            //string response = await UnvPmsManager.addVehicle(new VehicleInfo("粤GBH321"));
            //Console.WriteLine(response);

            //int[] array = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
            //Console.WriteLine(string.Join(",", new int[]{1,2,3}));
            //var result = from x in array where x>5 orderby x descending select x;
            //Console.WriteLine(string.Join(",",result));

            //string response = await UnvVmsManager.addPerson();
            //Console.WriteLine(response);


            //long timestampLeft = TimeFormatter.getCurrentTimestamp() - 10 * 60 * 60;
            //long timestampRight = TimeFormatter.getCurrentTimestamp();
            //string response = await UnvVmsManager.queryPassRecords(timestampLeft, timestampRight, 5, 0);
            //Console.WriteLine(response);


            #region 查询人员信息示例
            ////获取部门信息
            //string response = await UnvVmsManager.getDepartments();
            ////查询人员信息列表（不传参则默认查询全部，可传入部门id）
            //string response = await UnvVmsManager.queryPerson(23);
            ////查询人员信息列表（根据姓名、工号，若只有其中一个查询条件，则另一个传入空字符串）
            //string response = await UnvVmsManager.queryPerson("朱云川","");
            ////根据人员id获取人员信息详情(含图片，如果有)
            //string response = await UnvVmsManager.getPeronInfo(394);
            ////输出请求结果
            //Console.WriteLine(response);
            #endregion

            #region 增删改授权人员信息示例
            ////创建基本人员信息对象
            //PersonInfo personInfo = new PersonInfo("MK9991", "a123456kkk", "F:/zxj.jpg");
            ////设置一下Staff信息（非必要）
            //PersonInfo.StaffInfo staffInfo = new PersonInfo.StaffInfo { Birthday = "20240202", Number = "hbgruhrjk3241", DeptID = 23, DeptName = "宝信软件" };
            //personInfo.Staff= staffInfo;

            ////新增人员
            ////string response = await UnvVmsManager.addPerson(personInfo);

            ////设置人员id（updata才需要，add不需要）
            //personInfo.PersonID = 874;
            ////修改人员信息
            //string response = await UnvVmsManager.updatePerson(personInfo);
            ////删除人员
            //string response = await UnvVmsManager.deletePerson(new int[] { 875, 876 });
            //string response = await UnvVmsManager.deletePerson(877);

            ////输出请求结果
            //Console.WriteLine(response);
            #endregion

            #region 增删查改授权信息示例
            ////获取所有的授权组信息
            //string str = await UnvVmsManager.getPermissionList();
            //Console.WriteLine(str);
            ////通过上一步得知“电气室”的id是“16”，通过这个查询电气室的所有授权人员信息
            //str = await UnvVmsManager.queryPermission("16");
            //Console.WriteLine(str);

            ////新增授权组
            //int[] doorList = new int[] { 1079 };//至少要有一个门
            //int[] personList = new int[] { 848 };//至少要有一个人员

            //PermissionInfo permissionInfo = new PermissionInfo("测试用授权组", doorList, personList);
            //string response = await UnvVmsManager.addPermissionGroup(permissionInfo);

            ////修改授权组信息
            //int[] doorList = new int[] { 1079 };
            //int[] personList = new int[] { 626, 796 };
            //PermissionInfo permissionInfo = new PermissionInfo(20, "测试用授权组2", doorList, personList);
            //string response = await UnvVmsManager.updatePermissionGroup(permissionInfo);

            ////删除授权组
            //int[] idList = new int[] { 21 };//至少要有一个人员
            //string response = await UnvVmsManager.deletePermissionGroup(idList);
            ////输出请求结果
            //Console.WriteLine(response);

            #endregion
        }


    }
}
